C51 COMPILER V8.05a   GPIF                                                                 07/27/2016 14:52:13 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE GPIF
OBJECT MODULE PLACED IN gpif.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE gpif.c DEBUG OBJECTEXTEND

line level    source

   1          // This program configures the General Programmable Interface (GPIF) for FX2.     
   2          // Please do not modify sections of text which are marked as "DO NOT EDIT ...". 
   3          //                                                                                
   4          // DO NOT EDIT ...                  
   5          // GPIF Initialization              
   6          // Interface Timing      Sync         
   7          // Internal Ready Init   IntRdy=1     
   8          // CTL Out Tristate-able Binary       
   9          // SingleWrite WF Select     1     
  10          // SingleRead WF Select      0     
  11          // FifoWrite WF Select       3     
  12          // FifoRead WF Select        2     
  13          // Data Bus Idle Drive   Tristate     
  14          // END DO NOT EDIT                  
  15                                              
  16          // DO NOT EDIT ...       
  17          // GPIF Wave Names       
  18          // Wave 0   = unused       
  19          // Wave 1   = unused       
  20          // Wave 2   = FIFORd       
  21          // Wave 3   = FIFOWr       
  22                                   
  23          // GPIF Ctrl Outputs   Level   
  24          // CTL 0    = WEN#     CMOS        
  25          // CTL 1    = REN#     CMOS        
  26          // CTL 2    = OE#      CMOS        
  27          // CTL 3    = unused   CMOS        
  28          // CTL 4    = unused   Op Drain    
  29          // CTL 5    = unused   CMOS        
  30                                         
  31          // GPIF Rdy Inputs         
  32          // RDY0     = VS#            
  33          // RDY1     = HS#            
  34          // RDY2     = unused         
  35          // RDY3     = unused         
  36          // RDY4     = unused         
  37          // RDY5     = TCXpire        
  38          // FIFOFlag = FIFOFlag       
  39          // IntReady = IntReady       
  40          // END DO NOT EDIT         
  41          // DO NOT EDIT ...                                                                         
  42          //                                                                                         
  43          // GPIF Waveform 0: unused                                                                  
  44          //                                                                                         
  45          // Interval     0         1         2         3         4         5         6     Idle (7) 
  46          //          _________ _________ _________ _________ _________ _________ _________ _________
  47          //                                                                                         
  48          // AddrMode Same Val  Same Val  Same Val  Same Val  Same Val  Same Val  Same Val           
  49          // DataMode NO Data   NO Data   NO Data   NO Data   NO Data   NO Data   NO Data            
  50          // NextData SameData  SameData  SameData  SameData  SameData  SameData  SameData           
  51          // Int Trig No Int    No Int    No Int    No Int    No Int    No Int    No Int             
  52          // IF/Wait  Wait 1    Wait 1    Wait 1    Wait 1    Wait 1    Wait 1    Wait 1             
  53          //   Term A                                                                                
  54          //   LFunc                                                                                 
  55          //   Term B                                                                                
C51 COMPILER V8.05a   GPIF                                                                 07/27/2016 14:52:13 PAGE 2   

  56          // Branch1                                                                                 
  57          // Branch0                                                                                 
  58          // Re-Exec                                                                                 
  59          // Sngl/CRC Default   Default   Default   Default   Default   Default   Default            
  60          // WEN#         1         1         1         1         1         1         1         1    
  61          // REN#         1         1         1         1         1         1         1         1    
  62          // OE#          1         1         1         1         1         1         1         1    
  63          // unused       0         0         0         0         0         0         0         0    
  64          // unused       0         0         0         0         0         0         0         0    
  65          // unused       0         0         0         0         0         0         0         0    
  66          //                     
  67          // END DO NOT EDIT     
  68          // DO NOT EDIT ...                                                                         
  69          //                                                                                         
  70          // GPIF Waveform 1: unused                                                                  
  71          //                                                                                         
  72          // Interval     0         1         2         3         4         5         6     Idle (7) 
  73          //          _________ _________ _________ _________ _________ _________ _________ _________
  74          //                                                                                         
  75          // AddrMode Same Val  Same Val  Same Val  Same Val  Same Val  Same Val  Same Val           
  76          // DataMode NO Data   NO Data   NO Data   NO Data   NO Data   NO Data   NO Data            
  77          // NextData SameData  SameData  SameData  SameData  SameData  SameData  SameData           
  78          // Int Trig No Int    No Int    No Int    No Int    No Int    No Int    No Int             
  79          // IF/Wait  Wait 1    Wait 1    Wait 1    Wait 1    Wait 1    Wait 1    Wait 1             
  80          //   Term A                                                                                
  81          //   LFunc                                                                                 
  82          //   Term B                                                                                
  83          // Branch1                                                                                 
  84          // Branch0                                                                                 
  85          // Re-Exec                                                                                 
  86          // Sngl/CRC Default   Default   Default   Default   Default   Default   Default            
  87          // WEN#         1         1         1         1         1         1         1         1    
  88          // REN#         1         1         1         1         1         1         1         1    
  89          // OE#          1         1         1         1         1         1         1         1    
  90          // unused       0         0         0         0         0         0         0         0    
  91          // unused       0         0         0         0         0         0         0         0    
  92          // unused       0         0         0         0         0         0         0         0    
  93          //                     
  94          // END DO NOT EDIT     
  95          // DO NOT EDIT ...                                                                         
  96          //                                                                                         
  97          // GPIF Waveform 2: FIFORd                                                                  
  98          //                                                                                         
  99          // Interval     0         1         2         3         4         5         6     Idle (7) 
 100          //          _________ _________ _________ _________ _________ _________ _________ _________
 101          //                                                                                         
 102          // AddrMode Same Val  Same Val  Same Val  Same Val  Same Val  Same Val  Same Val           
 103          // DataMode NO Data   NO Data   NO Data   Activate  Activate  Activate  Activate           
 104          // NextData SameData  SameData  SameData  SameData  SameData  SameData  SameData           
 105          // Int Trig No Int    No Int    No Int    No Int    No Int    No Int    No Int             
 106          // IF/Wait  Wait 1    Wait 1    Wait 1    IF        Wait 1    Wait 1    Wait 1             
 107          //   Term A                               TCXpire                                          
 108          //   LFunc                                AND                                              
 109          //   Term B                               TCXpire                                          
 110          // Branch1                                ThenIdle                                         
 111          // Branch0                                Else 3                                           
 112          // Re-Exec                                No                                               
 113          // Sngl/CRC Default   Default   Default   Default   Default   Default   Default            
 114          // WEN#         1         1         1         1         1         1         1         1    
 115          // REN#         1         0         0         1         1         1         1         1    
 116          // OE#          1         1         0         1         1         1         1         1    
 117          // unused       0         0         0         0         0         0         0         0    
C51 COMPILER V8.05a   GPIF                                                                 07/27/2016 14:52:13 PAGE 3   

 118          // unused       0         0         0         0         0         0         0         0    
 119          // unused       0         0         0         0         0         0         0         0    
 120          //                     
 121          // END DO NOT EDIT     
 122          // DO NOT EDIT ...                                                                         
 123          //                                                                                         
 124          // GPIF Waveform 3: FIFOWr                                                                  
 125          //                                                                                         
 126          // Interval     0         1         2         3         4         5         6     Idle (7) 
 127          //          _________ _________ _________ _________ _________ _________ _________ _________
 128          //                                                                                         
 129          // AddrMode Same Val  Same Val  Same Val  Same Val  Same Val  Same Val  Same Val           
 130          // DataMode NO Data   Activate  Activate  Activate  Activate  Activate  Activate           
 131          // NextData SameData  SameData  SameData  SameData  SameData  SameData  SameData           
 132          // Int Trig No Int    No Int    No Int    No Int    No Int    No Int    No Int             
 133          // IF/Wait  Wait 1    IF        Wait 1    Wait 1    Wait 1    Wait 1    Wait 1             
 134          //   Term A           TCXpire                                                              
 135          //   LFunc            AND                                                                  
 136          //   Term B           TCXpire                                                              
 137          // Branch1            ThenIdle                                                             
 138          // Branch0            Else 1                                                               
 139          // Re-Exec            No                                                                   
 140          // Sngl/CRC Default   Default   Default   Default   Default   Default   Default            
 141          // WEN#         1         1         1         1         1         1         1         1    
 142          // REN#         1         1         1         1         1         1         1         1    
 143          // OE#          1         1         1         1         1         1         1         1    
 144          // unused       0         0         0         0         0         0         0         0    
 145          // unused       0         0         0         0         0         0         0         0    
 146          // unused       0         0         0         0         0         0         0         0    
 147          //                     
 148          // END DO NOT EDIT     
 149                                                        
 150          // GPIF Program Code                          
 151                                                        
 152          // DO NOT EDIT ...                            
 153          #include "fx2.h"                            
 154          #include "fx2regs.h"                        
 155          #include "fx2sdly.h"     // SYNCDELAY macro 
 156          // END DO NOT EDIT                            
 157                                                        
 158          // DO NOT EDIT ...                     
 159          const char xdata WaveData[128] =     
 160          {                                      
 161          // Wave 0 
 162          /* LenBr */ 0x01,     0x01,     0x01,     0x01,     0x01,     0x01,     0x01,     0x07,
 163          /* Opcode*/ 0x00,     0x00,     0x00,     0x00,     0x00,     0x00,     0x00,     0x00,
 164          /* Output*/ 0x07,     0x07,     0x07,     0x07,     0x07,     0x07,     0x07,     0x07,
 165          /* LFun  */ 0x00,     0x00,     0x00,     0x00,     0x00,     0x00,     0x00,     0x3F,
 166          // Wave 1 
 167          /* LenBr */ 0x01,     0x01,     0x01,     0x01,     0x01,     0x01,     0x01,     0x07,
 168          /* Opcode*/ 0x00,     0x00,     0x00,     0x00,     0x00,     0x00,     0x00,     0x00,
 169          /* Output*/ 0x07,     0x07,     0x07,     0x07,     0x07,     0x07,     0x07,     0x07,
 170          /* LFun  */ 0x00,     0x00,     0x00,     0x00,     0x00,     0x00,     0x00,     0x3F,
 171          // Wave 2 
 172          /* LenBr */ 0x01,     0x01,     0x01,     0x3B,     0x01,     0x01,     0x01,     0x07,
 173          /* Opcode*/ 0x00,     0x00,     0x00,     0x03,     0x02,     0x02,     0x02,     0x00,
 174          /* Output*/ 0x07,     0x05,     0x01,     0x07,     0x07,     0x07,     0x07,     0x07,
 175          /* LFun  */ 0x00,     0x00,     0x00,     0x2D,     0x00,     0x00,     0x00,     0x3F,
 176          // Wave 3 
 177          /* LenBr */ 0x01,     0x39,     0x01,     0x01,     0x01,     0x01,     0x01,     0x07,
 178          /* Opcode*/ 0x00,     0x03,     0x02,     0x02,     0x02,     0x02,     0x02,     0x00,
 179          /* Output*/ 0x07,     0x07,     0x07,     0x07,     0x07,     0x07,     0x07,     0x07,
C51 COMPILER V8.05a   GPIF                                                                 07/27/2016 14:52:13 PAGE 4   

 180          /* LFun  */ 0x00,     0x2D,     0x00,     0x00,     0x00,     0x00,     0x00,     0x3F,
 181          };                     
 182          // END DO NOT EDIT     
 183                                 
 184          // DO NOT EDIT ...                     
 185          const char xdata FlowStates[36] =   
 186          {                                      
 187          /* Wave 0 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 188          /* Wave 1 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 189          /* Wave 2 FlowStates */ 0x83,0x36,0x11,0x17,0x00,0x04,0x03,0x02,0x01,
 190          /* Wave 3 FlowStates */ 0x81,0x36,0x16,0x17,0x00,0x04,0x03,0x02,0x01,
 191          };                     
 192          // END DO NOT EDIT     
 193                                 
 194          // DO NOT EDIT ...                                               
 195          const char xdata InitData[7] =                                   
 196          {                                                                
 197          /* Regs  */ 0xE0,0x10,0x00,0x07,0x76,0x4E,0x00     
 198          };                                                               
 199          // END DO NOT EDIT                                               
 200                                                                           
 201          // TO DO: You may add additional code below.
 202          
 203          void GpifInit( void )
 204          {
 205   1        BYTE i;
 206   1        // Registers which require a synchronization delay, see section 15.14
 207   1        // FIFORESET        FIFOPINPOLAR
 208   1        // INPKTEND         OUTPKTEND
 209   1        // EPxBCH:L         REVCTL
 210   1        // GPIFTCB3         GPIFTCB2
 211   1        // GPIFTCB1         GPIFTCB0
 212   1        // EPxFIFOPFH:L     EPxAUTOINLENH:L
 213   1        // EPxFIFOCFG       EPxGPIFFLGSEL
 214   1        // PINFLAGSxx       EPxFIFOIRQ
 215   1        // EPxFIFOIE        GPIFIRQ
 216   1        // GPIFIE           GPIFADRH:L
 217   1        // UDMACRCH:L       EPxGPIFTRIG
 218   1        // GPIFTRIG
 219   1        
 220   1        // Note: The pre-REVE EPxGPIFTCH/L register are affected, as well...
 221   1        //      ...these have been replaced by GPIFTC[B3:B0] registers
 222   1       
 223   1        // 8051 doesn't have access to waveform memories 'til
 224   1        // the part is in GPIF mode.
 225   1       
 226   1        IFCONFIG = 0x52;
 227   1        // IFCLKSRC=0   , FIFOs executes on internal clk source
 228   1        // xMHz=1       , 48MHz internal clk rate
 229   1        // IFCLKOE=0    , Don't drive IFCLK pin signal at 48MHz
 230   1        // IFCLKPOL=1   , invert IFCLK pin signal from internal clk
 231   1        // ASYNC=1      , master samples asynchronous
 232   1        // GSTATE=1     , Drive GPIF states out on PORTE[2:0], debug WF
 233   1        // IFCFG[1:0]=10, FX2 in GPIF master mode
 234   1       
 235   1        GPIFABORT = 0xFF;  // abort any waveforms pending
 236   1       
 237   1        GPIFREADYCFG = InitData[ 0 ];
 238   1        GPIFCTLCFG = InitData[ 1 ];
 239   1        GPIFIDLECS = InitData[ 2 ];
 240   1        GPIFIDLECTL = InitData[ 3 ];
 241   1        GPIFWFSELECT = InitData[ 5 ];
C51 COMPILER V8.05a   GPIF                                                                 07/27/2016 14:52:13 PAGE 5   

 242   1        GPIFREADYSTAT = InitData[ 6 ];
 243   1       
 244   1        // use dual autopointer feature... 
 245   1        AUTOPTRSETUP = 0x07;          // inc both pointers, 
 246   1                                      // ...warning: this introduces pdata hole(s)
 247   1                                      // ...at E67B (XAUTODAT1) and E67C (XAUTODAT2)
 248   1        
 249   1        // source
 250   1        AUTOPTRH1 = MSB( &WaveData );
 251   1        AUTOPTRL1 = LSB( &WaveData );
 252   1        
 253   1        // destination
 254   1        AUTOPTRH2 = 0xE4;
 255   1        AUTOPTRL2 = 0x00;
 256   1       
 257   1        // transfer
 258   1        for ( i = 0x00; i < 128; i++ )
 259   1        {
 260   2          EXTAUTODAT2 = EXTAUTODAT1;
 261   2        }
 262   1       
 263   1      // Configure GPIF Address pins, output initial value,
 264   1        PORTCCFG = 0xFF;    // [7:0] as alt. func. GPIFADR[7:0]
 265   1        OEC = 0xFF;         // and as outputs
 266   1        PORTECFG |= 0x80;   // [8] as alt. func. GPIFADR[8]
 267   1        OEE |= 0x80;        // and as output
 268   1       
 269   1      // ...OR... tri-state GPIFADR[8:0] pins
 270   1      //  PORTCCFG = 0x00;  // [7:0] as port I/O
 271   1      //  OEC = 0x00;       // and as inputs
 272   1      //  PORTECFG &= 0x7F; // [8] as port I/O
 273   1      //  OEE &= 0x7F;      // and as input
 274   1       
 275   1      // GPIF address pins update when GPIFADRH/L written
 276   1        SYNCDELAY;                    // 
 277   1        GPIFADRH = 0x00;    // bits[7:1] always 0
 278   1        SYNCDELAY;                    // 
 279   1        GPIFADRL = 0x00;    // point to PERIPHERAL address 0x0000
 280   1       
 281   1      // Configure GPIF FlowStates registers for Wave 0 of WaveData
 282   1        FLOWSTATE = FlowStates[ 0 ];
 283   1        FLOWLOGIC = FlowStates[ 1 ];
 284   1        FLOWEQ0CTL = FlowStates[ 2 ];
 285   1        FLOWEQ1CTL = FlowStates[ 3 ];
 286   1        FLOWHOLDOFF = FlowStates[ 4 ];
 287   1        FLOWSTB = FlowStates[ 5 ];
 288   1        FLOWSTBEDGE = FlowStates[ 6 ];
 289   1        FLOWSTBHPERIOD = FlowStates[ 7 ];
 290   1      }
 291           


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    188    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =    171    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
